﻿using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
using MediatR;
using PoemGame.Events.Shared;
using PoemGame.MessageSender;
using PoemGame.MessageSender.MQ;

namespace PoemGame.Events.MediatR.Console
{
    internal class Utility
    {
        public static IServiceProvider GetServices()
        {
            var services = new ServiceCollection();
            services.AddMediatR(
                Assembly.Load("PoemGame.Events.MediatR.Handler"),
                Assembly.Load("PoemGame.Evnets.MediatR.OutBoundHandlers"));
            services.AddScoped<IMessageSender, MessageSenderMQ>();
            services.AddScoped<IOutBoundEventBus, OutBoundEventBus>();
            services.AddScoped<ILocalEventBus, LocalEventBus>();
            return services.BuildServiceProvider();
        }
    }
}
